<style>
.fui-list-inner .vip {
	background: #09ba07 none repeat scroll 0 0;
    color: #fff;
    position: absolute;
    margin-left: 0.2rem;
    height: 0.75rem;
    width: 0.75rem;
    vertical-align: top;
    z-index: 100;
    line-height: 1.1;
    text-align: center;
    border-radius: 0.85rem;
}
.item-up-content {background-color: #fff;border-radius: 10px;padding:0.5rem;}
.weui_cells {padding:0;margin-top:0}
.weui_cell_bd {padding:0;padding-bottom:0.3rem;padding-top:0.3rem;color:#999;font-size:0.7rem}
.weui_cell_hd {font-size:0.7rem;padding-bottom:0.3rem;padding-top:0.3rem;margin-right:0.3rem}
.item-ng {}
.item-ng .deleteitem {position: absolute;color:#000;margin-top:-1rem;right:0.5rem}
.weui_cells_title{font-weight: bold;margin:0.5rem;padding-left:0.2rem;padding-right:0}
.weui_input {
  background-color: #fff;
}
.pic {position:relative;font-size:0.6rem;}
.setimg {position:absolute;top:0.5rem;right:0.5rem;padding:0 0.5rem;color:#fff;background-color:rgba(0,0,0,0.5);border-radius:1rem;}
.fui-navbar, .fui-footer {
    width: auto;
	padding:0.3rem 0.5rem;
}
.fui-navbar .nav-item.btn {
    border-radius: 1rem;
	height:1.8rem;
}
</style>
<div class="fui-page fui-page-current" ng-if="pagedata.op=='main'">
	<div class="fui-content">
		<div class="content-block" style="padding:0.5rem">
			<div ng-include="sys_html('common/_diycontent')"></div>
			<div class="weui_cells_checkbox" style="margin-top:1.2rem">
					<div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem;font-size:0.56rem">
						<input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" ng-checked="pagedata.item.checked==true" ng-model="pagedata.item.checked">
						我已阅读并同意 <a ng-click="pagedata.show_xieyi=true" style="color:#61bba7">《会员协议》</a>
					</div>
			</div>
		</div>
	</div>
	<div class="fui-navbar">
		<div ng-if="!pagedata.item.id" style="width:30%;float:left"><a ng-click="pagedata.submit(1);" class="nav-item btn btn-success" style="color:#fff;border-right: 1px solid #fff;">保存预览</a></div>
		<div ng-if="!pagedata.item.id" style="width:70%;float:left"><a href="javascript:;" ng-click="pagedata.submit(0);" class="nav-item btn btn-success" style="color:#fff">发布动态</a></div>
		<div ng-if="pagedata.item.id>0" style="width:100%;float:left"><a href="javascript:;" ng-click="pagedata.submit(0);" class="nav-item btn btn-success" style="color:#fff">修改动态</a></div>
	</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.xieyi.title || '会员协议'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.xieyi.content)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.checked=1;" class="mod-check" style="width: 100%; margin: 0">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<script>
scope.pagedata.item.checked =true
scope.pagedata.submit=function(e,id){
	if(!scope.pagedata.item.checked){
		scope.message('请先阅读并勾选《会员协议》','error');
		return false;
	}
	if(!scope.pagedata.item.content){
		scope.message('内容不能为空！','error');
		return false;
	}
	if(votestrlen(scope.pagedata.item.title)>120){
		scope.message('标题不能超过60个字！','error');
		return false;
	}
	scope.pagedata.item.noshow = e==1?1:0;
	var params={
		data:scope.pagedata.item,
		op:'post',
		callback:function(res){
		}
	};
	scope.post_json(params);
}
function votestrlen(str){
	if(!str){
		return false;
	}
    var len = 0;
    for (var i=0; i<str.length; i++) { 
     var c = str.charCodeAt(i); 
    //单字节加1 
     if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { 
       len++; 
     } 
     else { 
      len+=2; 
     } 
    } 
    return len;
}
</script>